package com.zboot.zbootadmin.common.aspect;


import com.zboot.zbootadmin.common.utils.FileUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.io.File;

/**
 * @Author: zyt
 * @Description: 清空代码生成目录
 * @Date: Created in 21:25 2020/6/27
 */
@Aspect
@Component
public class DelCatalog {

    //表示匹配带有自定义注解的方法
    @Pointcut("@annotation(com.zboot.zbootadmin.common.annotation.DelCatalog)")
    public void back() {}

    @Before("back()")
    public void changeLendStatus(JoinPoint joinPoint) {
            String oPath = System.getProperty("user.dir");
            File dir = new File(oPath+"\\generateCode");
            /*if (!dir.exists()) {
                dir.mkdir();
            }*/
            FileUtils.removeDir(dir);
        }

}
